import axios from './request'

//上传文件的headers
const headers = {
  'Content-Type':`multipart/form-data; boundary=<calculated when request is sent>`,
}
/**
 * 基本请求
 */
export const login = data => axios.post('/user/login',data)

export const getUserInfo = params => axios.get('/user/info',{params})

export const editUserInfo = params => axios.put('/user/personal',params)

/**
 * 报文组
 */
export const changeFileInfo = params => axios.put('/file/update',params)

export const deleteFile = params => axios.delete('/file/delete',{params})

export const dataAnalysisi = data =>axios.post('/variable/calculate',data)
//已经上传的文件的名字
export const getFileList = data => axios.post('/file/list',data)
//上传文件
export const addFile = data => axios.post('/file/path',data)

export const getAnaStatus = params => axios.get('/analysis/status',{params})
/* export function addFile(params,data) {
  return axios({
    url: '/file/path',
    method: 'post',
    params,
		data,
    headers,
  })
} */

/**
 * 外部数据
 */
export const addExter = data => axios.post('/exter/add',data)

export const deleteExter = params => axios.delete('/exter/delete',{params})

export const changeExter = params => axios.put('/exter/update',params)
/**
 * 目标变量
 */
export function addTargetFile(params,data) {
  return axios({
    url: '/file/targetVariable',
    method: 'post',
    params,
    data,
    headers,
  })
}

export const getTargetFile = params => axios.post('/file/exporttarget',params,{responseType: 'blob'})

export const getTargetList = params => axios.get('/file/target',{params})
/**
 * 样本列表
 */
export const addSample = data => axios.post('/sample/add',data)

export const uploadSampleFile = data => axios.post('/sample/addfile',data)

export const deleteSample = params => axios.delete('/sample/delete',{params})

export const changeSampleInfo = params => axios.put('/sample/update',params)

export const getSampleList = params => axios.get('/sample/list',{params})

export const exportSample = params => axios.post('/sample/export',params,{responseType: 'blob'})
/**
 * 建模
 */
export const getColumns = params => axios.get('/sample/columns',{params})

export const saveModel = data => axios.post('/automatic/save',data)

export const deleteModel = params => axios.delete('/automatic/delete',{params})

export const getModelConf = params => axios.get('/automatic/parameter',{params})
  /**
   * autoSC
   */
//模型结果pdf
export const runAutoSC = data => axios.post('/automatic/autosc',data)

export const runAutoTR = data => axios.post('/automatic/autotr',data)

export const runAutoGAM = data => axios.post('/automatic/autogam',data)

export const runAutoML = data => axios.post('/automatic/automl',data)


/**
 * 获取模型信息->打开模型
 */
export const getModel = params => axios.get('/automatic/parameter',{params})


/**
 * 模型管理
 */
export const changeModel = params => axios.put('/model/update',params)

export const getModelList = params => axios.get('/model/list',{params})

export const delModel = params =>axios.delete('/model/delete',{params})
//下载结果
export const getResults = data => axios.post('/model/result',data,{responseType: 'blob'})
//模型结果
export const getModelResult = data => axios.post('/modelProc/create',data,{responseType: 'blob'})

//模型比较
export const runModelCompare = data => axios.post('/model/compare',data,{responseType: 'blob'})